home *** CD-ROM | disk | FTP | other *** search
/ Disc to the Future 2 / Disc to the Future Part II Programmer's Reference (Wayzata Technology)(6013)(1992).bin / UNIX / GRAPHICS / FC / README < prev    next >
Text File  |  1992-11-23  |  2KB  |  64 lines

  1.  
  2.  
  3.                      SOURCE CODE FOR THE FC CLIPPER
  4.  
  5.                             as implemented by
  6.  
  7.                               John Schultz
  8.  
  9.                                  4/15/90
  10.  
  11.  
  12.   The Fast Clipper (FC) 2D line clipper algorithm uses line encoding
  13. as opposed to end point encoding as with the Cohen-Sutherland (CS)
  14. method, or parametric methods of Liang-Barsky and Cyrus-Beck.  The
  15. Sobkow-Pospisil-Yang (SPY) paper shows benchmarks where the FC clipper
  16. is over twice as fast as the CS algorithm. The parametric methods are
  17. much slower.  The paper has a source code listing in C, which has a few
  18. errors.  These errors were in the #define statements for clipping to
  19. screen edges.  A divide and a subtract were left out:
  20.  
  21.   as published:
  22.     #define ClipPTop (*Px) = (*Px) + ((*Qx) - (*Px)) * (YTop - (*Py))
  23.  
  24.   should read:
  25.     #define ClipPTop (*Px) = (*Px) + ((*Qx) - (*Px)) * (YTop - (*Py)) /
  26.                                      ((*Qy) - (*Py))
  27.  
  28.   Once these errors were corrected, the algorithm worked properly.
  29. At the time I was experimenting with clipping, I was using a Modula-2
  30. compiler, so my HLL source is in modula-2.  The latest version is in
  31. 68000 assembly, linked to C test code.  
  32.  
  33.   The original paper on the FC algorithm was published in
  34. Computers & Graphics Vol. 11, No. 4, pp. 459-467, 1987
  35. Printed in Great Britain.  The publisher was Pergamon Journals Ltd.
  36.  
  37. Authors of the paper (and creators of the algorithm):
  38.  
  39.   Mark S. Sobkow, Paul Pospisil, and Yee-Hong Yang (to whom
  40. correspondence should be addressed), 
  41. Department of Computational Science, University of Saskatchewan, Saskatoon,
  42. Saskatchewan, Canada S7N 0W0.
  43.  
  44.  
  45.   I never tested my code against any other algorithms, so I'm curious to
  46. see if it is twice as fast as SC. Please let me know of any further
  47. optimizations.
  48.  
  49.  
  50.  
  51.   John
  52.  
  53.  
  54.  
  55.   Files for FC:
  56.  
  57.     readme
  58.     clip.a
  59.     cliptest.c
  60.     makefile
  61.     clip2d.def
  62.     clip2d.mod
  63.  
  64.